GetPos Function

private function GetPos(id) result(pos)

return the position in practices array given practice id

Arguments

Type IntentOptional Attributes Name
integer(kind=long), intent(in) :: id

Return Value integer(kind=long)


Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i

Source Code

FUNCTION GetPos &
!
(id) &
!
RESULT (pos)

IMPLICIT NONE

!arguments with intent(in):
INTEGER (KIND = long), INTENT(IN) :: id

!local declarations:
INTEGER (KIND = long) :: pos
INTEGER (KIND = short) :: i

!---------------------------------end of declarations--------------------------

pos = 0
DO i = 1, SIZE (practices)
    IF ( practices (i) % id == id) THEN
        pos = i
        EXIT
    END IF
    
END DO


RETURN
END FUNCTION GetPos